using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page 
{
    public static VncWeb rDesktop = new VncWeb();
    public static double radomNum;
    static System.Random ran = new Random(1000);
    bool flag = true;
    public _Default()
    {
        rDesktop.VncPort = 5900;
        rDesktop.Password = "dharmik";
        if (!rDesktop.IsConnected)
            rDesktop.Connect("192.168.0.101");
        //rDesktop.Password = "local";
        //if (!rDesktop.IsConnected)
        //    rDesktop.Connect("192.168.0.121");


        radomNum = ran.NextDouble();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        rDesktop.DataBind();
        rDesktop.DataBind();
    }
    protected void Timer1_Tick(object sender, EventArgs e)
    {
        try
        {
            if (flag)
            {
                flag = false;
                rDesktop.update();
                this.img.ImageUrl = "getImage.aspx?id=" + radomNum.ToString();
            }
            else
                flag = true;
            //rDesktop.desktop.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
            //radomNum = ran.NextDouble();
            
           
            //this.img.DataBind();
        }
        catch{}

        
    }
}
